<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="format-detection" content="telephone=no,email=no,adress=no">
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){

	logicCondition();
	
	$('#merNo').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
    	minChars:1,
    	paramName:'merNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});

	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

function logicCondition(){
	if($("#high").prop("checked")){
		$(".ac").show();
	}else{
		$(".ac").hide();
	}
}

</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="logic_view.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;" >
<tr>
<td height="25" >
	<b>操作说明:多个交易号可以用逗号隔开</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield  id="txnNo" name="txnNo" placeholder="关联交易号"></s:textfield>
<s:textfield  id="txnOrder" name="txnOrder" placeholder="商户订单号"></s:textfield>
<s:textfield  id="txnSite" name="txnSite" placeholder="来源网站"></s:textfield>
<s:textfield  id="logName" name="logName" placeholder="物流公司"></s:textfield>
<s:textfield  id="logOrder" name="logOrder" placeholder="物流单号"></s:textfield>
<s:textfield  id="logDateTop"  name="logDateTop" placeholder="上传日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="logDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="logDateEnd"  name="logDateEnd" placeholder="上传日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="logDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>

<input type="button" class="submit" value="提交查询" onclick="sform.submit();"/>
<input type="button" class="submit" value="高级搜索" onclick="$('#high').click();"/>
<s:checkbox id="high" name="high"  onclick="logicCondition();" cssStyle="display:none;"></s:checkbox>
</td>
</tr>
<tr><td><hr/></td></tr>
<tr class="ac" style="display: none;">
<td height="30" >
<s:select id="txnRefund" name="txnRefund" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="退款状态"/>
<s:select id="txnRefuse" name="txnRefuse" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="拒付状态"/>
<s:select id="txnFreeze" name="txnFreeze" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="冻结状态"/>
<s:select id="txnLogic" name="txnLogic" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="发货状态"/>
<s:select id="txnSettle" name="txnSettle" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="结算状态"/>
<s:select id="txnDanger" name="txnDanger" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="安全状态"/>
<s:select id="txnVisible" name="txnVisible" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="隐藏状态"/>
<s:select id="txnState" name="txnState" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="交易状态"/>
<s:textfield  id="txnDateTop"  name="txnDateTop" placeholder="交易发生日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="txnDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="txnDateEnd"  name="txnDateEnd" placeholder="交易发生日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="txnDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
</td>
</tr>
<tr class="ac"   style="display: none;"><td><hr/></td></tr>

<tr>
<td height="30" >
	<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit"   value="导出数据"  onclick="if(confirm('确认要执行导出操作吗?')){window.open(location.href.replace('view','export'));}"/>
		<input type="button" class="submit" value="批量驳回" onclick="location.href='<%=request.getContextPath()%>/logic_savebatch.html?logNos='+$('#keys').val()"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="关联交易号" onclick="toSort('sortField','txnNo')"/>
		<input type="button" class="submit" value="物流公司" onclick="toSort('sortField','logName')"/>
		<input type="button" class="submit" value="物流单号" onclick="toSort('sortField','logOrder')"/>
		
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'txnNo', width:'10%',align:'left' , halign: 'left'">交易号</th>
<th data-options="field:'merNo', width:'5%',align:'left' , halign: 'left'">商户编号</th>
<th data-options="field:'txnOrder', width:'8%',align:'left' , halign: 'left'">商户订单号</th>
<th data-options="field:'txnSite', width:'12%',align:'left' , halign: 'left'">来源网站</th>
<th data-options="field:'logName', width:'10%',align:'left' , halign: 'left'">物流公司</th>
<th data-options="field:'logOrder', width:'12%',align:'left' , halign: 'left'">物流单号</th>
<th data-options="field:'logDate', width:'12%',align:'left' , halign: 'left'">上传日期</th>
<th data-options="field:'txnRefund', width:'2%',align:'left' , halign: 'left'">退</th>
<th data-options="field:'txnRefuse', width:'2%',align:'left' , halign: 'left'">拒</th>
<th data-options="field:'txnFreeze', width:'2%',align:'left' , halign: 'left'">冻</th>
<th data-options="field:'txnLogic', width:'2%',align:'left' , halign: 'left'">发</th>
<th data-options="field:'txnSettle', width:'2%',align:'left' , halign: 'left'">结</th>
<th data-options="field:'txnDanger', width:'2%',align:'left' , halign: 'left'">危</th>
<th data-options="field:'txnState', width:'2%',align:'left' , halign: 'left'">付</th>
<th data-options="field:'txnDate', width:'10%',align:'left' , halign: 'left'">交易日期</th>

</tr>
</thead>
<tbody>
<s:iterator value="logicTransactionList" id="show" status="seq">
<tr>

<td><s:property value="#show.logNo"/></td>
<td><a href="<%=request.getContextPath()%>/transaction_show.html?txnNo=<s:property value="#show.txnNo"/>"><s:property value="#show.txnNo"/></a></td>
<td><a href="<%=request.getContextPath()%>/merchant_show.html?merNo=<s:property value="#show.merNo"/>"><s:property value="#show.merNo"/></a></td>
<td><s:property value="#show.txnOrder"/></td>
<td><a href="<%=request.getContextPath()%>/website_list.html?webAddress=<s:property value="#show.txnSite"/>"><s:property value="#show.txnSite"/></a></td>
<td><s:property value="#show.logName"/></td>
<td><s:property value="#show.logOrder"/></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.logDate"/></s:text>
<td><s:if test="#show.txnRefund==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnRefuse==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnFreeze==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnLogic==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnSettle==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnDanger==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:if test="#show.txnState==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.txnDate"/></s:text>

</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
